#include <stdio.h>

int nextIceNum(int num) {
    // Perfect Freeze!
    return (num & 1) ? (3 * num + 1) : (num / 2);
}

int main() {
    int target;
    scanf("%d", &target);
    while (target != 1) {
        printf("%d ", target);
        target = nextIceNum(target);
    }
    printf("1");
    return 0;
}